var e = require("../../../@babel/runtime/helpers/interopRequireDefault").default, a = e(require("../../../kta/index")), t = require("../../../config/CT_share_index/index.js"), n = e(require("../../../api/api_CTShare")), i = e(require("../../../behaviors/aucMiniAuth")), o = e(require("../../../behaviors/auth")), u = e(require("../../../libs/fecha/index.js")), c = e(require("../../../utils/Tips")), r = getApp();

Component({
    behaviors: [ i.default, o.default ],
    data: {
        CTImageBaseUrl: t.imageBaseUrl.CT_share_index,
        chooseIndex: "1",
        endDate: "",
        phone: "",
        actionEndFlag: !1
    },
    attached: function() {
        this.setData({
            actionEndFlag: r.globalData.actionEndFlag,
            phone: r.globalData.aucPhone
        }), this.getActInfo();
    },
    methods: {
        showForbiddenToast: function() {
            c.default.toast("活动已过期");
        },
        afterBindgetphonenumber: function(e) {
            "0" === e.code ? (r.globalData.aucPhone = e.data.phone, this.setData({
                phone: r.globalData.aucPhone
            })) : c.default.toast("绑定手机号失败"), r.globalData.aucMiniAuth.sid = "", this.getActInfo().then(function() {
                c.default.toast("您已绑定成功，请点击邀请按钮来分享活动哦~");
            });
        },
        gotoIndex: function() {
            wx.navigateBack({
                delta: 1
            });
        },
        changeTab: function(e) {
            "1" === e.currentTarget.dataset.index ? a.default.clickStat("562aaef7258240a2989b3220ec1e056e", {
                userphone: r.globalData.aucPhone
            }) : "2" === e.currentTarget.dataset.index && a.default.clickStat("7ed5fd77668b489e9c68b51dfbb251dd", {
                userphone: r.globalData.aucPhone
            }), this.setData({
                chooseIndex: e.currentTarget.dataset.index
            });
        },
        clickInv: function() {
            a.default.clickStat("c1c8c8f881094289b40e723c7d9122af", {
                userphone: r.globalData.aucPhone
            });
        },
        getActInfo: function() {
            var e = this;
            return new Promise(function(a, t) {
                n.default.getActInfo().then(function(t) {
                    var n = t.code, i = t.result;
                    t.msg;
                    if ("0" === n) {
                        var o = u.default.format(new Date(i.actEndTime), "YYYY[年]MM[月]DD[日]");
                        e.setData({
                            endDate: o
                        });
                    }
                    a();
                });
            });
        }
    }
});